﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace HuntWump2
{
    class TriviaStubsFinal
    {
        //there are currently 31 questions in "triviaQuestions.txt"
        public int nOfQuestions = 31;
        public int nOfSecrets = 10;
        public static Random rand = new Random(9);

        //arrays here
        public String[] questions;
        public static String[] secrets;
        public AnswerSetFinal[] answers;
        public static String realSecret;

        public TriviaStubsFinal()
        {
            readQuestions();
            ReadAnswers();
            ReadSecrets();
        }

        public void readQuestions()
        {
            questions = File.ReadAllLines("triviaQuestions.txt");
            nOfQuestions = questions.Length;
        }

        public void ReadAnswers()
        {
            String[] temp = File.ReadAllLines("triviaAnswers.txt");
            answers = new AnswerSetFinal[nOfQuestions];

            //to read each answerSet
            for (int i = 0; i < nOfQuestions; i++)
            {
                answers[i] = new AnswerSetFinal(temp[(5 * i)], temp[(5 * i + 1)], temp[(5 * i + 2)], temp[(5 * i + 3)]);
                
            }
        }

        //secrets to be read here
        public void ReadSecrets()
        {
            secrets = File.ReadAllLines("Secrets.txt");
            nOfSecrets = secrets.Length;
        }

        //get secret
        public static String getSecret()
        {

            int randomIndex = rand.Next(9);
            realSecret = secrets[randomIndex];
            return realSecret;
        }
    }
    }

